function urlParamsToObject(url) {
  const params = new URLSearchParams(url);
  const paramObj = {};
  for (let [key, value] of params) {
    paramObj[key] = decodeURIComponent(value);
  }
  return paramObj;
}

function debounce(func, wait, immediate) {
  let timeout;

  return function () {
    const context = this;
    const args = arguments;

    const later = function () {
      timeout = null;
      if (!immediate) func.apply(context, args);
    };

    const callNow = immediate && !timeout;

    clearTimeout(timeout);
    timeout = setTimeout(later, wait);

    if (callNow) func.apply(context, args);
  };
}


function replaceFontToP(html) {
  return html.replace(/<font size="3"/g, '<p').replace(/<\/font>/g, '</p>').replace('max-width: 700px', '').replace(/font-size:\s*[^;]+;?/g, '')
}
